<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/page/inc/taglib.jsp"%>
<div class="pageHeader">
	<form id="pagerForm" onsubmit="return navTabSearch(this);" action="${pageContext.request.contextPath}/investment/investment/list" method="post">
		<!-- 分页表单参数 -->
		<%@include file="/WEB-INF/page/inc/pageForm.jsp"%>
		<!-- 需要排序的字段 -->
		<input type="hidden" name="orderField" value="${requestScope.dwzPageBean.countResultMap.orderField}" />
		<!-- 正序倒序 -->
		<input type="hidden" name="orderDirection" value="${requestScope.dwzPageBean.countResultMap.orderDirection}" />
		
		<input type="hidden" name="state" value="${requestScope.dwzPageBean.countResultMap.state}" />
		<input type="hidden" name="today" value="${requestScope.dwzPageBean.countResultMap.today}" />
		
		
		
		<div style="width: 100%;height: 100px;line-height: 127px;text-align: center;">
		<a title="售前客户" target="navTab" rel="${pageContext.request.contextPath}/investment/investment/list" href="${pageContext.request.contextPath}/investment/investment/list?state=1" style="display: inline-block;background: #dcdfe4;padding: 28px 45px 20px 45px;text-decoration: none;">未联系客户<br><span style="display: block;margin-top: 6px;">${requestScope.uncontacted}</span></a>
		<a title="售前客户" target="navTab" rel="${pageContext.request.contextPath}/investment/investment/list" href="${pageContext.request.contextPath}/investment/investment/list?today=${requestScope.today}" style="display: inline-block;background: #dcdfe4;padding: 28px 38px 20px 38px;text-decoration: none; margin-left: 170px;">今日回访客户<br><span style="display: block;margin-top: 6px;">${requestScope.todayCount}</span></a>
		<a title="售前客户" target="navTab" rel="${pageContext.request.contextPath}/investment/investment/list" href="${pageContext.request.contextPath}/investment/investment/list" style="display: inline-block;background: #dcdfe4;padding: 28px 52px 20px 52px;text-decoration: none; margin-left: 170px;">全部客户<br><span style="display: block;margin-top: 6px;">${requestScope.count}</span></a>
		</div>


		<div class="searchBar">
			<table class="searchContent">
				<tr>
					<td>姓名： <input size="25" placeholder="请输入姓名" name="org1.name" type="text" postField="name" suggestFields="name" suggestUrl="${pageContext.request.contextPath}/investment/investment/getInvestmentName" lookupGroup="org1" value="${requestScope.dwzPageBean.countResultMap.name}" />
					</td>
					
					<td>电话号码： <input size="25" placeholder="请输入电话号码" name="org2.phone" type="text" postField="phone" suggestFields="phone" suggestUrl="${pageContext.request.contextPath}/investment/investment/getInvestmentPhone" lookupGroup="org2" value="${requestScope.dwzPageBean.countResultMap.phone}" />
					</td>
					<td><label style="width: 30px;">性别：</label> <select name="sex" class="combox">
							<option value="">请选择</option>
							<option value="0" ${requestScope.dwzPageBean.countResultMap.sex == 0?'selected':''}>女</option>
							<option value="1" ${requestScope.dwzPageBean.countResultMap.sex == 1?'selected':''}>男</option>
					</select></td>
					<%-- <td><label style="width: 30px;">状态：</label> <select name="state" class="combox">
							<option value="">请选择</option>
							<option value="1" ${requestScope.dwzPageBean.countResultMap.state == 1?'selected':''}>未联系</option>
							<option value="2" ${requestScope.dwzPageBean.countResultMap.state == 2?'selected':''}>跟进中</option>
					</select></td> --%>
					<td><label class="nowrap">客户意向：</label>
					<select name="intent" class="combox">
						<option value="" selected="selected">请选择</option>
						<option value="A" ${requestScope.dwzPageBean.countResultMap.intent == 'A' ? "selected":""}>A</option>
						<option value="B" ${requestScope.dwzPageBean.countResultMap.intent == 'B' ? "selected":""}>B</option>
						<option value="C" ${requestScope.dwzPageBean.countResultMap.intent == 'C' ? "selected":""}>C</option>
						<option value="D" ${requestScope.dwzPageBean.countResultMap.intent == 'D' ? "selected":""}>D</option>
					</select>
					</td>
					</tr>
					<tr>
					<%-- <td><label style="width: 30px;">状态：</label> <select name="state" class="combox">
							<option value="">请选择</option>
							<option value="1" ${requestScope.dwzPageBean.countResultMap.state == 1?'selected':''}>未联系</option>
							<option value="2" ${requestScope.dwzPageBean.countResultMap.state == 2?'selected':''}>跟进中</option>
					</select></td> --%>
					<td colspan="2">咨询时间：<input name="startTime" class="date textInput readonly" readonly="true" type="text" value="${requestScope.dwzPageBean.countResultMap.startTime}" placeholder="请选择添加时间" style="margin-right: 5px;">至<input style="margin-left: 5px;" name="endTime" class="date textInput readonly" readonly="true" minDate="" type="text" value="${requestScope.dwzPageBean.countResultMap.endTime}" placeholder="请选择添加时间" ></td>
					
					<%-- <c:if test="${requestScope.isDirector==false}"> --%>
					<td colspan="2">跟进时间：<input name="startFwTime" class="date textInput readonly" readonly="true" type="text" value="${requestScope.dwzPageBean.countResultMap.startFwTime}" placeholder="请选择跟进时间" style="margin-right: 5px;">至<input style="margin-left: 5px;" name="endFwTime" class="date textInput readonly" readonly="true" minDate="" type="text" value="${requestScope.dwzPageBean.countResultMap.endFwTime}" placeholder="请选择跟进时间"></td>
					<%-- </c:if> --%>
				</tr>
				<tr>
					<!-- 省市区联动查询 -->
					<td><label class="nowrap" style="width: 28px;">省：</label> <input type="hidden" name="areaName" class="required" value="${requestScope.record.areaName}" /> <select class="combox required" name="areaCode" id="inv_combox_province" ref="inv_combox_city" refUrl="${pageContext.request.contextPath}/system/areas/getCityByProvince?id={value}&isSearch=true" default-value="110000">
							<option value="">请选择</option>
							<c:forEach items="${requestScope.provinces}" var="item">
								<option value="${item.id}" ${item.id==requestScope.dwzPageBean.countResultMap.province?"selected":""}>${item.name}</option>
							</c:forEach>
					</select></td>
					<td><label class="nowrap" style="width: 30px;">市：</label><select class="combox required" name="areaCode" id="inv_combox_city" ref="inv_combox_region" refUrl="${pageContext.request.contextPath}/system/areas/getCountyByAreas?id={value}&isSearch=true" default-value="110100">
							<option value="">请选择</option>
							<c:forEach items="${requestScope.citys}" var="item">
								<option value="${item.id}" ${item.id==requestScope.dwzPageBean.countResultMap.city?"selected":""}>${item.name}</option>
							</c:forEach>
					</select></td>
					<td><label class="nowrap" style="width: 52px;">区：</label><select class="combox required" name="areaCode" id="inv_combox_region" default-value="110100">
							<option value="">请选择</option>
							<c:forEach items="${requestScope.countys}" var="item">
								<option value="${item.id}" ${item.id==requestScope.dwzPageBean.countResultMap.county?"selected":""}>${item.name}</option>
							</c:forEach>
					</select></td>
					<c:if test="${requestScope.isDirector==false}">
						<td><label class="nowrap">跟进人：</label>
							<select name="maid" class="combox">
								<option value="">请选择</option>
								<c:forEach items="${requestScope.employees}" var="EmployeesItem">
									<option value="${EmployeesItem.employeeId}" ${EmployeesItem.employeeId == requestScope.dwzPageBean.countResultMap.maid?'selected':''}>${EmployeesItem.employeeName}</option>
								</c:forEach>
							</select>
						</td>
					</c:if>
					
					<td>
						<ul>
							<li>
								<div class="buttonActive">
									<div class="buttonContent">
										<button type="submit">查询</button>
									</div>
								</div>
							</li>
						</ul>
					</td>
				</tr>
			</table>
		</div>
	</form>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<shiro:hasPermission name="/investment/investment/export">
				<li><a href="${pageContext.request.contextPath}/investment/investment/export" target="dwzExport" targetType="navTab" title="是要导出这些记录吗?" class="icon"><span>导出EXCEL</span></a></li>
			</shiro:hasPermission>
			<shiro:hasPermission name="/investment/investment/toImportExcel">
				<li><a class="icon" href="${pageContext.request.contextPath}/investment/investment/toImportExcel" target="dialog" width="820" height="460" targetType="navTab" mask="true"><span>导入EXCEL</span></a></li>
			</shiro:hasPermission>
			<shiro:hasPermission name="/investment/investment/toInsert">
				<li><a class="add" href="${pageContext.request.contextPath}/investment/investment/toInsert" rel="insert" target="dialog" width="820" height="460" mask="true"><span>添加</span></a></li>
			</shiro:hasPermission>
			<shiro:hasPermission name="/investment/investment/delete">
				<li><a class="delete" href="${pageContext.request.contextPath}/investment/investment/delete" rel="id" target="selectedTodo" title="确定要删除吗？" warn="请最小选择一条记录" mask="true"><span>批量删除</span></a></li>
			</shiro:hasPermission>
			
			<shiro:hasPermission name="/investment/investment/toUpdateMaid">
				<li><a class="edit" href="javascript:;" onclick="toUpdateMaid()" warn="请最小选择一条记录" mask="true"><span>批量修改跟进人</span></a></li>
			</shiro:hasPermission> 
		</ul>
	</div>
	<table class="table" targetType="navTab" asc="asc" desc="desc" width="100%" layoutH="263">
		<thead>
			<tr>
				<th width="22"><input type="checkbox" group="id" class="checkboxCtrl"></th>
				<th orderField="name" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'name'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>姓名</th>
				<th orderField="sex" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'sex'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>性别</th>
				<th orderField="phone" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'phone'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>电话</th>
				<th orderField="other" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'other'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>其他联系方式</th>
				<%-- <th orderField="date" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'date'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>日期</th> --%>
				<th orderField="time" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'time'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>咨询时间</th>

				<th orderField="area_name" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'area_name'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>地区</th>
				<th orderField="source" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'source'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>客户来源</th>
				<th orderField="state" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'state'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>状态</th>
				<th orderField="intent" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'intent'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>客户意向</th>
				<th orderField="ntfw" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'ntfw'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>下一次跟进时间</th>
				<th orderField="mename" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'mename'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>跟进人</th>

				<%-- <th orderField="type" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'type'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>招商类型</th> --%>

				<%-- <th orderField="add_time" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'add_time'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>添加时间</th> --%>

				<th>操作</th>
			</tr>
		</thead>
		<tbody>

			<c:if test="${requestScope.dwzPageBean != null &&  requestScope.dwzPageBean.recordList != null }">
				<c:forEach var="record" items="${requestScope.dwzPageBean.recordList}" varStatus="status">
					<tr ondblclick="openDetails(this)" target="navTab" href="${pageContext.request.contextPath}/investment/investmentFollow/list?id=${record.id}" title="详情">
						<td><input name="id" value="${record.id}" type="checkbox"></td>
						<td>${record.name}</td>
						<td>${record.sex == 1?'男':''}${record.sex == 0?'女':''}</td>
						<td>${record.phone}</td>
						<td>${record.other}</td>
						<%-- <td><fmt:formatDate value="${record.date}" pattern='yyyy-MM-dd'/></td> --%>
						<td><fmt:formatDate value="${record.time}" pattern='yyyy-MM-dd HH:mm:ss'/></td>
						<td>${record.areaName}</td>
						<td>${record.source}</td>
						<td>${record.state == 1?'未联系':''}${record.state == 2?'跟进中':''}</td>
						<td>${record.intent}</td>
						<td><fmt:formatDate value="${record.ntfw}" pattern='yyyy-MM-dd' /></td>
						<td>${record.mename}</td>
						<%-- <td>${record.val}</td> --%>

						<%-- <td><fmt:formatDate value="${record.addTime}" pattern='yyyy-MM-dd' /></td> --%>


						<td>
							<%-- <shiro:hasPermission name="/investment/investment/orderlist">
								<a title="详情" target="dialog" href="${pageContext.request.contextPath}/investment/investment/orderlist?id=${record.id}" class="detailsBtn" mask="true" width="820" height="460"><span>详情</span></a>
							</shiro:hasPermission> --%> <shiro:hasPermission name="/investment/investmentFollow/list">
								<a title="详情" target="navTab" rel="${pageContext.request.contextPath}/investment/investmentFollow/list" href="${pageContext.request.contextPath}/investment/investmentFollow/list?id=${record.id}&state=${requestScope.dwzPageBean.countResultMap.state}&today=${requestScope.dwzPageBean.countResultMap.today}" class="detailsBtn" mask="true"><span>详情</span></a>
							</shiro:hasPermission> <shiro:hasPermission name="/investment/investment/toUpdate">
								<a title="编辑" target="dialog" width="820" height="460" href="${pageContext.request.contextPath}/investment/investment/toUpdate?id=${record.id}&state=${requestScope.dwzPageBean.countResultMap.state}&today=${requestScope.dwzPageBean.countResultMap.today}" class="editBtn" mask="true"><span>编辑</span></a>
							</shiro:hasPermission> <shiro:hasPermission name="/investment/investment/delete">
								<a title="确定要删除吗？" mask="true" target="ajaxTodo" href="${pageContext.request.contextPath}/investment/investment/delete?id=${record.id}&state=${requestScope.dwzPageBean.countResultMap.state}&today=${requestScope.dwzPageBean.countResultMap.today}" class="deleteBtn" mask="true"><span>删除</span></a>
							</shiro:hasPermission>
						</td>


					</tr>
				</c:forEach>
			</c:if>

		</tbody>
	</table>
	<%-- <table class="table" targetType="navTab" asc="asc" desc="desc" width="100%" layoutH="138">
		<thead>
			<tr>
				<th width="22"><input type="checkbox" group="id" class="checkboxCtrl"></th>
				<th orderField="name" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'name'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>姓名</th>
				<th orderField="sex" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'sex'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>性别</th>
				<th orderField="phone" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'phone'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>电话</th>
				<th orderField="area_name" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'area_name'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>地区名称</th>
				<th orderField="intent" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'intent'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>客户意向</th>
				<th orderField="state" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'state'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>状态</th>
				<th orderField="mename" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'mename'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>跟进人</th>
				<th orderField="val" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'val'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>招商类型</th>
				<th orderField="add_time" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'add_time'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>添加时间</th>
				<th orderField="remk1" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'remk1'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>备注1</th>
				<th orderField="remk2" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'remk2'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>备注2</th>
				<th orderField="remk3" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'remk3'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>备注3</th>
				<th orderField="remk4" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'remk4'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>备注4</th>
				<th orderField="remk5" <c:if test="${requestScope.dwzPageBean.countResultMap.orderField == 'remk5'}">class="${requestScope.dwzPageBean.countResultMap.orderDirection}"</c:if>>备注5</th>
				<th width="280">操作</th>
			</tr>
		</thead>
		<tbody>
			<c:if test="${requestScope.dwzPageBean != null &&  requestScope.dwzPageBean.recordList != null }">
				<c:forEach var="record" items="${requestScope.dwzPageBean.recordList}" varStatus="status">
					<tr ondblclick="openDetails(this)" target="dialog" href="${pageContext.request.contextPath}/investment/investment/orderlist?id=${record.id}" title="详情">
						<td><input name="id" value="${record.id}" type="checkbox"></td>
						<td>${record.name}</td>
						<td>${record.sex == 1?'男':''}${record.sex == 0?'女':''}</td>
						<td>${record.phone}</td>
						<td>${record.areaName}</td>
						<td>${record.intent}</td>
						<td>${record.state == 1?'未联系':''}${record.state == 2?'沟通跟进中':''}${record.state == 3?'无效':''}${record.state == 4?'已成交':''}</td>
						<td>${record.mename}</td>
						<td>${record.val}</td>
						<td><fmt:formatDate value="${record.addTime}" /></td>
						<td>${record.remk1}</td>
						<td>${record.remk2}</td>
						<td>${record.remk3}</td>
						<td>${record.remk4}</td>
						<td>${record.remk5}</td>
						<td><shiro:hasPermission name="/investment/investment/orderlist">
								<a title="详情" target="dialog" href="${pageContext.request.contextPath}/investment/investment/orderlist?id=${record.id}" class="detailsBtn" mask="true" width="820" height="460"><span>详情</span></a>
							</shiro:hasPermission> <shiro:hasPermission name="/investment/investmentFollow/list">
								<a title="跟进记录" target="navTab" rel="${pageContext.request.contextPath}/investment/investment/list" href="${pageContext.request.contextPath}/investment/investmentFollow/list?id=${record.id}" class="editBtn" mask="true"><span>跟进记录</span></a>
							</shiro:hasPermission> <shiro:hasPermission name="/investment/investment/toUpdate">
								<a title="编辑" target="dialog" href="${pageContext.request.contextPath}/investment/investment/toUpdate?id=${record.id}" class="editBtn" mask="true"><span>编辑</span></a>
							</shiro:hasPermission> <shiro:hasPermission name="/investment/investment/delete">
								<a title="确定要删除吗？" mask="true" target="ajaxTodo" href="${pageContext.request.contextPath}/investment/investment/delete?id=${record.id}" class="deleteBtn" mask="true"><span>删除</span></a>
							</shiro:hasPermission></td>
					</tr>
				</c:forEach>
			</c:if>
		</tbody>
	</table> --%>
	<!-- 分页条 -->
	<%@include file="/WEB-INF/page/inc/pageBar.jsp"%>
</div>
<script type="text/javascript">
function toUpdateMaid(){
	var ids ="" ;
	$("input[name='id']").each(function(){
		if(this.checked){
			ids+=this.value + ",";
		}
	});
	if(ids.length==0){
		alertMsg.error("请最小选择一条记录");
		return;
	}
	ids = ids.substring(0, ids.lastIndexOf(','));
	$.pdialog.open('${pageContext.request.contextPath}/investment/investment/toUpdateMaid?ids='+ids, '/investment/investment/toUpdateMaid', '批量修改跟进人', {
		width : 820,
		height : 460,
		mask : true,
		resizable : true,
		drawable : false 
	});
}
</script>